//
//  Contact.m
//  OC05_NSArray_NSDictionary_NSSet
//
//  Created by Scott on 16/3/2.
//  Copyright © 2016年 Rain. All rights reserved.
//

#import "Contact.h"

@implementation Contact

#pragma mark - init
- (instancetype)initWithName:(NSString *)name phoneNumber:(NSString *)phoneNumber {
    
    self = [super init];
    if (self) {
        _name = name;
        _phoneNumber = phoneNumber;
        
        // 根据name, 获取其首字母, 然后转化为大写, 最后赋值给_groupNama实例变量.
        _groupName = [[name substringToIndex:1] uppercaseString];
    }
    return self;
}

#pragma mark - 构造器
+ (instancetype)contactWithName:(NSString *)name phoneNumber:(NSString *)phoneNumber {
    
    return [[Contact alloc] initWithName:name phoneNumber:phoneNumber];

}

#pragma mark - other
- (void)info {
    
    NSLog(@"name:%@, phoneNumber:%@, sex:%@, address:%@, age:%@", _name, _phoneNumber, _sex, _address, _age);
}





@end
